(require 'cl)
(require 'google-translate)
(defun gt-region-or-word ()
  "Return region or word around point.
If `mark-active' on, return region string.
Otherwise return word around point."
  (if mark-active
      (buffer-substring-no-properties (region-beginning)
                                      (region-end))
    (thing-at-point 'word)))
    ;; (word-at-point)))

(defun google-translate-en-zh ()
  (interactive)
  (google-translate-pop	  "en" "zh-CN" (gt-region-or-word))
  (start-process "test-process" "*Messages*" "myplay" (gt-region-or-word))
  ;; (start-process "test-google-process" "*Messages*" "speech.sh" (gt-region-or-word)) 
)

;; (defun google-translate-en-zh-with-speech ()
;;   (interactive)
;;   (google-translate-pop	  "en" "zh-CN" (gt-region-or-word))
;;   (start-process "test-process" "*Messages*" "myplay" (gt-region-or-word))
;;   ;; (start-process "test-google-process" "*Messages*" "speech.sh" (gt-region-or-word)) 
;; )

(defun google-speech-en ()
  (interactive)
  (start-process "test-process" "*Messages*" "speech.sh" (gt-region-or-word))
)
;; (start-process "test-process" "*Messages*" "myplay" "test")
(setq google-translate-default-source-language "zh-CN")
(setq google-translate-default-target-language "en")
(provide 'gt-setting)
